<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>品牌特卖</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <style media="screen">
        .wrap {
            width: 100%;
            padding: 0 15px;
            overflow: hidden;
        }

        .ShakeWellGoods {
            width: 100%;
            background: #fff;
            border-radius: 5px;
            margin-top: 10px;
            overflow: hidden;
        }

        .ShakeWellGoods_inner {
            width: 100%;
            padding: 5px;
            box-sizing: border-box;
            overflow: hidden;
        }

        .ShakeWellGoods_inner .content {
            display: flex;
            margin-top: 10px;
        }

        .ShakeWellGoods_inner .head {
            width: 100%;
            overflow: hidden;
            display: flex;
            justify-content: space-between;
        }

        .ShakeWellGoods_inner .head .head_l {
            width: 100%;
            display: flex;
        }

        .ShakeWellGoods_inner .head .head_l div:first-child {
            width: 35px;
            height: 25px;
            /*border:1px solid red;*/
        }

        .ShakeWellGoods_inner .head .head_l div:first-child img{
            display: block;
            width: 100%;
            height: 100%;
            /*border: 1px solid green;*/
        }

        .ShakeWellGoods_inner .head .head_l div:last-child {
            margin-left: 5px;
            flex: 1;
            min-width: 0;
        }

        .ShakeWellGoods_inner .head .head_l div:last-child span {
            display: block;
        }

        .ShakeWellGoods_inner .head .head_l div:last-child span.name {
            width: auto;
            height:25px;
            font-size: 15px;
            font-family: PingFang SC;
            font-weight: 500;
            color: #333333;
            line-height: 25px;
        }

        /*.ShakeWellGoods_inner .head .head_l div:last-child span.sale {
            width: auto;
            height: 13px;
            font-size: 12px;
            font-family: PingFang SC;
            font-weight: 500;
            color: #FF3537;
            line-height: 13px;
            margin-top: 2px;
        }*/

        .ShakeWellGoods_inner .head .head_r{
            width:65px;
            height: 25px;
            line-height: 25px;
            font-size: 12px;
            font-family: PingFang SC;
            font-weight: 500;
            color: #fff;
            background: linear-gradient(-90deg,#fd6e70,#f8483f);
            text-align: center;
            border-radius: 10px;
        }

        .ShakeWellGoods_inner>.content div.item {
            flex: 1;
            width: 100px;
            height: 100%;
            padding: 5px;
            box-sizing: border-box;
            background-color: #fff;
            margin-left: 3px;
        }

        .ShakeWellGoods_inner>.content div.item:first-child {
            margin-left: 0px;
        }

        .ShakeWellGoods_inner>.content div.item .goods_picture {
            width: 100%;
            height: 100px;
            /*background-color: blue;*/
        }

        .ShakeWellGoods_inner>.content div.item .goods_picture img {
            width: 100%;
            height: 100%;
            display: block;
        }

        .ShakeWellGoods_inner>.content div.item .goods_name {
            width: 100%;
            height: 13px;
            font-size: 12px;
            font-family: PingFang SC;
            font-weight: 400;
            color: #444444;
            line-height: 13px;
            margin-top: 6.5px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            text-align: center;
        }

        .ShakeWellGoods_inner>.content div.item .coupon {
            display: flex;
            margin-top: 5px;
        }

        .ShakeWellGoods_inner>.content div.item .coupon .coupon_l {
            width: 37px;
            height: 15px;
            line-height: 15px;
            font-size: 10px;
            text-align: center;
            color: #fff;
            background: #FF4242;
            border-radius: 2.5px;
        }

        .ShakeWellGoods_inner>.content div.item .coupon .coupon_r {
            width: 51px;
            height: 15px;
            background: url(../../image/arebuyingcoupon_bg.png) no-repeat;
            background-size: 100% 100%;
            line-height: 15px;
            font-size: 10px;
            text-align: center;
            color: #FF4242;
        }

        .ShakeWellGoods_inner>.content div.item .goods_price {
            display: flex;
            margin-top: 6.5px;
        }

        .ShakeWellGoods_inner>.content div.item .goods_price a:first-child {
            width: auto;
            height: 13px;
            line-height: 13px;
            font-size: 12px;
            font-family: PingFang SC;
            font-weight: 400;
            color: #FF4242;
        }

        .ShakeWellGoods_inner>.content div.item .goods_price a:last-child {
            width: auto;
            height: 11px;
            line-height: 12px;
            font-size: 10px;
            font-family: PingFang SC;
            font-weight: 400;
            text-decoration: line-through;
            color: #999999;
            margin-top: 1px;
            margin-left: 4px;
        }
        [v-cloak] {
            display: none!important;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="wrap">
            <div class="ShakeWellGoods" v-for='item in dataList'>
                <div class="ShakeWellGoods_inner">
                    <div class="head">
                        <div class="head_l">
                            <div><img :src="item.brandLogo" alt=""></div>
                            <div>
                                <span class="name">{{item.fqBrandName}}</span>
                                <!-- <span class="sale"></span> -->
                            </div>
                        </div>
                        <div class="head_r" @click='openBrandSaleDetailsPage(item.id,item.fqBrandName)'>
                            MORE
                        </div>
                    </div>
                    <div class="content" >
                        <div class="item" v-for='itm in item.item' @click='openGoodsDtailsPage(itm.itemid)'>
                            <div class="goods_picture"><img :src="itm.itempic" alt=""></div>
                            <div class="goods_name">{{itm.itemshorttitle}}</div>
                            <!-- <div class="coupon">
                           <div class="coupon_l">爆款</div>
                           <div class="coupon_r">99元券</div>
                       </div> -->
                            <div class="goods_price">
                                <a>¥{{itm.itemendprice}}</a>
                                <a>¥{{itm.itemprice}}</a>
                            </div>
                        </div>
                        <div class="item" v-if='item.item.length<2'></div>
                        <div class="item" v-if='item.item.length<2'></div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript" src="../../script/cling.js"></script>
<script type="text/javascript">
    apiready = function() {
        console.log(api.pageParam.id);
        vm.init(api.pageParam.id);
        vm.initRefresh();
        vm.bottomLoad();
    }
    var vm = new Vue({
        el: '#app',
        data: {
            dataList: [],
            minId:1,
            mid:''
        },
        methods: {
            clearData: function() {
                vm.dataList = [];
            },
            init: function(brandcat, isClick) {
                console.log(brandcat);
                vm.brandcat = brandcat
                if (isClick) {
                    vm.minId = vm.mid;
                } else { // 下拉刷新 或者 初次加载
                    vm.minId = 1;
                }
                cl.openLoading();
                api.ajax({
                    url: cl.apiServer + 'brand/getBrandList',
                    method: 'post',
                    headers: {
                        'Content-Type': 'application/json;charset=utf-8',
                        token:cl.userToken
                    },
                    data: {
                        body: {
                            back: 20,
                            brandcat: brandcat,
                            minId: vm.minId,
                            version:cl.deviceInfo().appVersion,
                            mobileInfo:cl.systemType()
                        }
                    }
                }, function(ret, err) {
                    if (ret) {
                        console.log(JSON.stringify(ret));
                        if (ret.code == 0) {
                            cl.closeLoading();
                            if (ret.data.length >= 10) {
                                vm.mid = ret.data.minId;
                                vm.no_more = false;
                                vm.dataList = vm.dataList.concat(ret.data);
                            } else if (ret.data.length == 0) {
                                vm.no_more = true;
                            } else {
                                vm.dataList = vm.dataList.concat(ret.data);
                            }

                        }
                    }
                });
            },
            //下拉刷新
            initRefresh: function() {
                cl.openRefresh(function() {
                    vm.init(vm.materialId, false);
                })
            },
            //上拉加载
            bottomLoad: function() {
                cl.scrollBottom(function() {
                    vm.init(vm.materialId, true);
                })
            },
            openGoodsDtailsPage: function(id) {
                console.log(id);
                cl.openWin({
                    name: 'goods_deatils',
                    pageParam: {
                        id: id
                    }
                })
            },
            openBrandSaleDetailsPage:function(id,title){
              cl.openWin({
                  name: 'brand_sale_details',
                  pageParam: {
                      id: id,
                      title:title
                  }
              })
            }
        }
    });
</script>

</html>
